//
//  PromptBox.m
//  家盟商城
//
//  Created by 李志权 on 2016/11/24.
//  Copyright © 2016年 李志权. All rights reserved.
//

#import "PromptBox.h"

@implementation PromptBox

- (id)initWithPrompt:(NSString *)prompt
{
    if (self = [super init]) {
        self = [[[NSBundle mainBundle]loadNibNamed:@"PromptBox" owner:self options:nil] lastObject];
        UIWindow *window = [[UIApplication sharedApplication]keyWindow];
        self.frame = window.bounds;
        self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
        self.Y = Height;
        [UIView animateWithDuration:0.25 animations:^{
            self.Y = 0;
        }];
        [window addSubview:self];
        if (prompt) {
            self.prompt.text = prompt;
        }
        [self.prompt.superview setShearRound:5 masksToBounds:YES borderWidth:0 borderColor:nil];
    }
    return  self;
}
- (IBAction)btnclick:(id)sender {
    [UIView animateWithDuration:0.25 animations:^{
        self.Y = Height;
    } completion:^(BOOL finished) {
        [self removeFromSuperview];
    }];
}
@end
